public class Var {
    public static void main(String[] args) {
        int a = 100;
        int b = 100;
        String str = "一百";
        System.out.println(a);
        System.out.println(b);
        System.out.println(a + b);
        System.out.println(a - b);
        System.out.println(a * b);
        System.out.println(a / b);
        System.out.println(str);
        System.out.println(a + str);  //会把a转换为String类型
        System.out.println(100 + 3 + str);//103一百 算100 + 3 = 103
        System.out.println(100 + str + 3);//把100和3都转换成了String类型
        System.out.println(str + 100 + 3);//把100和3都转换成了String类型
        System.out.println("==========================");

        Byte n = 3;
        short m = 3;
        System.out.println(n);
        System.out.println(m);
        //都输出三 Byte类型的大小只有一个字节大小 short有两个字节大小

        System.out.println("========================");
        double num1 = 3.1415926353;
        float num2 = 3.14159926353f;
        System.out.println(num1);//double 8 个字节
        System.out.println(num2);//float 4 个字节
        double p = 2.7;
        double t = 8.1 / 3;
        System.out.println((p == t));//false 计算机的小数点精度不确定
        //解决方法 控制精度
        if (Math.abs(p - t) < 0.0000001) {
            System.out.println("相同");
        } else {
            System.out.println("不同");
        }
        System.out.println((Math.abs(p - t) < 0.00001));
        System.out.println("==========================");
        char c1 = 'a';
        char c2 = 97;
        char c3 = '赵';
        char c4 = '\n';
        System.out.println(c1);
        System.out.println(c2);
        System.out.println(c3);
        System.out.println(c4);
        System.out.println((int)c3);
        char c5 = 36213;
        System.out.println(c5);
        //char 占 2 个字节大小

        //boolean 只能是 true 或者 false 占字节大小没有明确规定
        //Byte short char int long
        //float double
        Byte z1 = 10;
        short z2 = 10;
        //Byte z3 = z1 + z2;//会报错 Byte 和 short 会转换成int类型？
        double d = 100;
        int d2 = 'z';
        System.out.println(d); //100.0
        System.out.println(d2);//122 自动类型转换 低 - > 高

        float f1 = 100.1f;
        double f2 = 3.15;
        int i = 3;
        System.out.println(f1 + f2 + i); //会转换成最大的
        //int ii = f1 + f2 + i; //err

        int it = (int)1.9;
        System.out.println(it);//精度丢失
        byte b2 = (byte)300;//数据溢出
        System.out.println(b2);
    }
}

